Component({
  mixins: [],
  data: {
    value: [0, 0],
    subOptions: []
  },
  props: {
    options: [],
    show: false,
    onClose: () => { },
    onChange: () => { }
  },
  didMount() { },
  didUpdate() { },
  didUnmount() { },
  methods: {
    closeCategoryPicker() {
      this.props.onClose()
    },
    onSubmitCategoryPicker() {
      let arr = [...this.data.value];
      if (!this.props.options[arr[0]].children || !this.props.options[arr[0]].children.length) {
        arr.splice(1, 1);
      }
      this.props.onChange(arr);
    },
    onMultiPickerChange(e) {
      let [mainIndex] = this.data.value;
      let [mainIndex2] = e.detail.value;
      if (mainIndex !== mainIndex2) {
        e.detail.value[1] = 0
      }
      this.setData({
        value: e.detail.value
      });
    }
  },
});
